package com.jinly.ryder.deploy.service.model;

import lombok.Data;

import java.time.LocalDateTime;

/**
 * 部署实例记录
 */
@Data
public class DeployRecord {

    private Long id;

    /**
     * 发布，重启
     */
    private DeployType deployType;

    /**
     * 主机
     */
    private String host;

    /**
     * 端口
     */
    private Integer port;

    /**
     * 部署申请ID
     */
    private Long applyId;

    /**
     * 实例ID
     */
    private Integer instanceId;

    /**
     * 部署结果
     */
    private Boolean success;

    /**
     * 消息
     */
    private String msgText;

    /**
     * 部署开始时间
     */
    private LocalDateTime beginTime;

    /**
     * 部署结束时间
     */
    private LocalDateTime endTime;

    /**
     * 操作人
     */
    private Long operator;

    public void setResult(boolean success, String msgText) {
        this.success = success;
        this.msgText = msgText;
        this.endTime = LocalDateTime.now();
    }
}
